package com.qlc.spring.cloud.demo.user;

import com.qlc.spring.cloud.demo.Result;
import com.qlc.spring.cloud.demo.user.VO.UserVO;
import com.qlc.spring.cloud.demo.user.http.UserHttpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * Name:  UserConsumerController
 * User:  wang chang
 * CreateTime: 2019-05-28 16:41
 **/
@RestController
public class UserConsumerController {

    @Autowired
    UserHttpService userHttpService;

    @RequestMapping(value = "s/n4")
    public Result<Void> addUser() {
        UserVO userVO = new UserVO();
        userVO.setUserCode("0004");
        userVO.setAge(37);
        userVO.setMobile("10010");
        Result<Void> str = userHttpService.addUser(userVO);
        return str;
    }


    @RequestMapping(value = "/s/n5")
    public Result<UserVO> queryUserByCode5() {
        Result<UserVO> r = userHttpService.getUserByCode("0008");
        return r;
    }

    @RequestMapping(value = "/s/n6")
    public Result<UserVO> queryUserByCode6() {
        Result<UserVO> r = userHttpService.getUserByCode("0002");
        return r;
    }
}
